﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;
using MyLib;

namespace WebPortal.YWYY
{
    public partial class HistoryTB : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string tian = Request.QueryString["tianname"].ToString().Trim();//提案名称
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat(@"select tianbumen||tianrenname username,tianrencode,tiandate,tianname,tiansummary,diaochaff,diaochaqk, ziliaozl,decode(status,'0','未完结','已完结') status from proc_fwdy_tibaoshenqing where tianname like '%{0}%'", tian);

            DataTable dt = DataAccess.Instance("BizDB").ExecuteDataTable(sb.ToString());
            if (dt == null || dt.Rows.Count == 0)
            {
                string scriptstrs = "<script>alert('查找不到该提案名称及对应信息！');</script>";

                if (!Page.ClientScript.IsStartupScriptRegistered(this.GetType(), "welcome"))
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "welcome", scriptstrs);
                }
            }
            else
            {
                RepeaterItemInfo.DataSource = dt;
                RepeaterItemInfo.DataBind();
            }
        }

        //查询
        protected void Button1_Click(object sender, EventArgs e)
        {
            string department = tianname.Text.ToString().Trim();//提案名称
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat(@"select tianbumen||tianrenname username,tianrencode,tiandate,tianname,tiansummary,diaochaff,diaochaqk, ziliaozl,decode(status,'0','未完结','已完结') status from proc_fwdy_tibaoshenqing where tianname like '%{0}%'", department);

            DataTable dt = DataAccess.Instance("BizDB").ExecuteDataTable(sb.ToString());
            if (dt == null || dt.Rows.Count == 0)
            {
                string scriptstrs = "<script>alert('查找不到该提案名称及对应信息！');</script>";

                if (!Page.ClientScript.IsStartupScriptRegistered(this.GetType(), "welcome"))
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "welcome", scriptstrs);
                }
            }
            else
            {
                RepeaterItemInfo.DataSource = dt;
                RepeaterItemInfo.DataBind();
            }
        }
    }
}